package com.jrtc.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jrtc.base.entity.bo.PrescriptionLabelThree;
import com.jrtc.dao.PrescriptionLabelThreeDao;
import com.jrtc.service.PrescriptionLabelThreeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 运动处方三级分类(PrescriptionLabelThree)表服务实现类
 *
 * @author makejava
 * @since 2022-09-08 13:37:16
 */
@Service("prescriptionLabelThreeService")
public class PrescriptionLabelThreeServiceImpl implements PrescriptionLabelThreeService
{
    @Resource
    private PrescriptionLabelThreeDao prescriptionLabelThreeDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PrescriptionLabelThree queryById(Integer id) {
        return this.prescriptionLabelThreeDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<PrescriptionLabelThree> queryAllByLimit(int offset, int limit) {
        return this.prescriptionLabelThreeDao.queryAllByLimit(offset, limit);
    }

    @Override
    public IPage<PrescriptionLabelThree> queryPrescriptionLabelThreeList(PrescriptionLabelThree prescriptionLabelThree)
    {
        com.baomidou.mybatisplus.extension.plugins.pagination.Page<PrescriptionLabelThree> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(prescriptionLabelThree.getPageNo(), prescriptionLabelThree.getPageSize() );
        IPage<PrescriptionLabelThree> prescriptionLabelThreePage = this.prescriptionLabelThreeDao.queryPrescriptionLabelThreeList(page, prescriptionLabelThree);
        return prescriptionLabelThreePage;
    }
    /**
     * 新增数据
     *
     * @param prescriptionLabelThree 实例对象
     * @return 实例对象
     */
    @Override
    public PrescriptionLabelThree insert(PrescriptionLabelThree prescriptionLabelThree) {
        this.prescriptionLabelThreeDao.insert(prescriptionLabelThree);
        return prescriptionLabelThree;
    }

    /**
     * 修改数据
     *
     * @param prescriptionLabelThree 实例对象
     * @return 实例对象
     */
    @Override
    public PrescriptionLabelThree update(PrescriptionLabelThree prescriptionLabelThree) {
        this.prescriptionLabelThreeDao.update(prescriptionLabelThree);
        return this.queryById(prescriptionLabelThree.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.prescriptionLabelThreeDao.deleteById(id) > 0;
    }
}